function scores = score(vixresults,schalf)

[numdays,numcols] = size(vixresults);
scores = zeros(numdays,numcols);
scdecay = (0.5)^(1/schalf);
%set seed levels
currmean = mean(vixresults(1:schalf,:));
currsigma = std(vixresults(1:schalf,:));
scores(1,:) = (vixresults(1,:)-currmean)./currsigma;

%score the time series
for i = 2:numdays
    currmean = currmean*scdecay+vixresults(i,:)*(1-scdecay);
    currsigma = sqrt((currsigma.^2)*scdecay+((vixresults(i,:)-currmean).^2)*(1-scdecay));
    scores(i,:) = (vixresults(i,:)-currmean)./currsigma;
end

%compute product variables 
% scores(:,7) = sum(sign(scores(:,[2 6])),2).*prod(abs(scores(:,[1 2 3])),2);
% scores(:,8) = sum(sign(scores(:,[1 3 5])),2).*prod(abs(scores(:,[1 3 5])),2);

%add dummy variables for regression
% scores(:,numcols+1) = 1;
scores = max(-2,min(2,scores));
end